<template>
  <view class="index-container">
    <view class="index-bg">
    </view>
    <view class="index-userinfo-box">
      <view class="userinfo">
        <image src="../../static/img/default-img.png" mode="widthFix"></image>
        <view class="userinfo-desc">
          <text>测试人员</text>
          <text style="margin-top: 16rpx;">交警</text>
        </view>
      </view>
      <view class="button-group">
        <view
          class="button-item"
          @click="toDriverList"
        >
          人员列表
        </view>
        <view
			class="button-item"
			@click="toStudyRecord"
		>
          学习记录
        </view>
        <view
          @click="toReportList"
          class="button-item"
        >
          报表
        </view>
      </view>
    </view>
  </view>
</template>

<script>
  import dd from 'gdt-jsapi';
  export default {
    data() {
      return {
        token: ''
      };
    },
    mounted () {
      uni.getStorage({
        key: 'token',
        success: (res) => {
          if (!res.data) {
            uni.navigateTo({
              url: '../../pages/login/login'
            })
            return
          }
          this.token = res.data
          this.init()
        }
      })
    },
    methods: {
      toReportList () {
        uni.navigateTo({
          url: '/pages/reportList/reportList',
        })
      },
      toStudyRecord () {
        uni.navigateTo({
          url: '/pages/study-record/study-record'
        })
      },
      toDriverList () {
        uni.navigateTo({
          url: '../../pages/driverList/driverList'
        })
      },
      init () {
        // 页面pv事件埋点
        this.$aplus.aplus_queue.push({
          'action':'aplus.sendPV',
          'arguments':[{
            is_auto: false
          }, {
            sapp_id:'19344',//isv根据实际填写自己应用的参数
            sapp_name:'zhongdianchelian',//isv根据实际填写自己应用的参数
            // 自定义PV参数key-value键值对，以下内容必填，根据应用实际情况设置。
            page_id: 'index',//isv根据实际填写自己应用的参数
            page_name: '首页',//isv根据实际填写自己应用的参数
            page_url: 'pages/index/index'//isv根据实际填写自己应用的参数
          }]
        })
        // dd.getAuthCode({corpId: '50222545'}).then(res =>{
        //     console.log(res)
        // }).
        // catch(err =>{})
        // this.$http.get('Muck/GetStaffList',{
        //   Token: this.token
        // }).then(res=>{
        //   this.driverList = res.result.List
        //   uni.showToast({
        //     title:res.result.Count + '条信息'
        //   })
        // }).catch(err=>{
        //   const msg = err.result || err
        //   uni.showToast({
        //     title:'获取数据失败,'+msg,
        //     icon:'none'
        //   })
        // })
      }
    }
  }
</script>

<style lang="scss">
.index-container{
  position: relative;
  .index-bg{
    background-color: #3988FF;
    height: 300rpx;
    width: 100%;
  }
  .index-userinfo-box{
    background-color: #FFFFFF;
    height: 400rpx;
    width: 90%;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 5vw;
    border-radius: 8rpx;
    box-shadow: 0px 6rpx 16rpx 0px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    padding: 0rpx 32rpx;
    .userinfo {
      flex: 1;
      height: 0;
      display: flex;
      align-items: center;
      height: 100%;
      image {
        width: 160rpx;
        border-radius: 50%;
      }
      .userinfo-desc{
        margin-left: 32rpx;
        flex-direction: column;
        display: flex;
        align-items: center;
        font-size: 32rpx;
        font-weight: 600;
      }
    }
    .button-group{
      height: 150rpx;
      border-top: 1rpx solid #E6E6E6;
      // margin: 0rpx 32rpx;
      box-sizing: border-box;
      display: flex;
      flex-wrap: wrap;
      .button-item {
        width: 33%;
        display: flex;
        justify-content: center;
        align-items: center;
        font-weight: 600;
      }
    }
  }
}
</style>
